All Questions
69 questions
2votes
2answers
342views
commands execution based on file size fails with no apparent issues
I was working on an array job for a small pipeline, and I happened to need a way to execute a specific command based on file size. I found this post and similar which describe how to do it. At the ...
0votes
1answer
248views
Is it a good idea to put "export BASH_ENV=~/.bashrc" in my .bashrc?
Let's say my Bash has some extensive ~/.bashrc customization that aids me not only in interactive use, but also in scripting (aliases, functions, variables, etc.). I would like to have this available ...
0votes
1answer
735views
execute script from another script not working [closed]
I am using shell scripts to compile the different components. I have one main script which is calling another shell script. Here is an example, Repo/build.sh Repo/code/mode/1/build/build_1.sh Now if ...
0votes
1answer
146views
How might I source a Bash script from another interactive Bash script?
I have a interactive Bash script, conozcoArrays.sh, #!/usr/bin/bash echo -e "\nGive me their phone number?\n" read number TOGOes=("$(find ~/chicas -maxdepth 1 -iname "*$number*&...
-3votes
2answers
1kviews
Bash Script - Expand ESCAPED dollar-sign ($) into its Variable
My Problem I have this run.sh script: #!/bin/bash TODAY=$(date) FILE="my_file.txt.\${TODAY}" When I echo FILE I get this: echo ${FILE} Output: `my_file.txt.${TODAY}` But I want this: echo $...
0votes
0answers
254views
Script for awscli check not working with crontab schedule
I have written a small code snippet to check the aws cli version #!/usr/bin/env bash if [ -e "/usr/local/bin/aws" ]; then myAWS="/usr/local/bin/aws" else ...
1vote
0answers
32views
What is the name of this ENV definition ${HOME:-/home}? [duplicate]
I am creating a shell script to deploy a container, and found in some docker files this definition of ENV: ${HOME:-/home}. I want to know what is the name of this kind of definition and where can I ...
0votes
1answer
1kviews
How to correctly add variable to environment or session
I work with a opensource software that I have built locally. After build the manual says to run it like this while inside the build directory $ LD_LIBRARY_PATH=../applicationExeFile Then the ...
0votes
1answer
108views
Save every output of same command in different variables
#!/bin/bash SERVERLABEL=( 11011-22022 33033-44044-10101 55055-10001-20002 ) for vmlabel in "${SERVERLABEL[@]}" do linode-cli linodes list | grep $vmlabel | grep -E -o &...
0votes
0answers
20views
Is it possible to export env vars to current shell, from within a child process/script [duplicate]
Is it possible to export env vars to the current shell, from within a child process/script that was executed from the current shell? Take this ultra-simplified example script: #!/bin/bash export FOO=&...
1vote
1answer
964views
Teeing each output while capturing return exit code (are any env variable) and passing it back "up the chain"
I've been struggling and reading quite a bit about this, and clearly bash is probably not the best tool for this, but since I'm already dug this deep into this hole (too much of the code is already ...
0votes
1answer
1kviews
Using `env` command with `eval`
Suppose I have this in script.sh: env -i SOMEVAR=SOMEVALUE eval -- "$@" I run it with: ./script.sh echo "\$SOMEVAR" Now it shows: env: ‘eval’: No such file or directory I ...
0votes
0answers
1kviews
shared library not found even if "export LD_LIBRARY_PATH" is set
Here comes a strange question. I have a QT App and it requires some libraries. Normally, the following bash script works: #!/bin/bash export LD_LIBRARY_PATH="./libs" export QT_DEBUG_PLUGINS=...
1vote
1answer
897views
Why does $HOME not expand the HOME variable here?
I wrote a simple script. read -p "Enter the path: " path echo "$path" I give the input as $HOME And the output is: $HOME And if I write echo "$HOME" outputs /home/sam ...
2votes
1answer
4kviews
Environment variable expansion inside $(command substitution)
I'm running Bash 5.1.4 on Debian. I'm writing a post-installation script to copy configuration and other files to locations in my home directory. I add the intended destination to each file at the ...